<template>
    <div>
        <el-dialog :visible.sync="dialogVisible" @close="closeLog">
            <div>
                <span>设置紧急程度：</span>
                <el-radio-group v-model="formData.urgencyType">
                    <el-radio v-for="item in urgencyTypeList" :key="item.value" :label="item.value">{{ item.label
                        }}</el-radio>
                </el-radio-group>
            </div>

            <template slot="footer">
                <el-button @click="dialogVisible = false">取消</el-button>
                <el-button type="primary" @click="submit()">保存</el-button>
            </template>
        </el-dialog>
    </div>
</template>

<script>
import {
    setReplyUrgency,
} from "@/api/member";
export default {
    props: {
        urgencyTypeList: {
            type: Array,
            default: []
        }
    },
    data() {
        return {
            dialogVisible: false,
            formData: {
                urgencyType: '',
                id: ''
            }
        }
    },
    methods: {
        submit() {
            if(!this.formData.urgencyType) return this.$message.error('请填写紧急类型名称');
            setReplyUrgency(this.formData).then(res=> {
                this.$message.success('修改成功');
                this.closeLog()
                this.$emit('getList')
            })
        },
        closeLog() {
            this.dialogVisible = false;
            this.formData = {
                urgencyType: '',
                id: ''
            }
        },
        editUrgencyType(v) {
            this.formData.urgencyType = v.urgencyType
            this.formData.id = v.id
            this.dialogVisible = true
        }
    },
}
</script>

<style></style>